<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /*
      - console.log("undefined3")
      - console.log(4)
      - console.log("undefined2")
      - console.log(1)
      - console.log("undefined1")
      - console.log(2)
      - console.log(3)
      resolve(2)
      resolve(3)
      resolve(1)
      */
      /*
        先要计算参数表达式
        */
      Promise.resolve(1)
        .then(
          Promise.resolve(3)
            .then(() => console.log(3))
            .then(() => console.log("undefined1"))
        )
        .then(() => console.log(1)) //1
        .then(
          Promise.resolve(2)
            .then(() => console.log(2))
            .then(() => console.log("undefined2"))
        )
        .then(() => console.log(4)) //2

        .then(() => console.log("undefined3"));
    </script>
  </body>
</html>
